package com.ruoyi.web.controller.business;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.Assessmentresult;
import com.ruoyi.system.service.IAssessmentresultService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 评价报告Controller
 * 
 * @author gzhuangwei
 * @date 2022-09-17
 */
@RestController
@RequestMapping("/business/assessmentresult")
public class AssessmentresultController extends BaseController
{
    @Autowired
    private IAssessmentresultService assessmentresultService;

    /**
     * 查询评价报告列表
     */
    @PreAuthorize("@ss.hasPermi('business:assessmentresult:list')")
    @GetMapping("/list")
    public TableDataInfo list(Assessmentresult assessmentresult)
    {
        startPage();
        List<Assessmentresult> list = assessmentresultService.selectAssessmentresultList(assessmentresult);
        return getDataTable(list);
    }

    /**
     * 导出评价报告列表
     */
    @PreAuthorize("@ss.hasPermi('business:assessmentresult:export')")
    @Log(title = "评价报告", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Assessmentresult assessmentresult)
    {
        List<Assessmentresult> list = assessmentresultService.selectAssessmentresultList(assessmentresult);
        ExcelUtil<Assessmentresult> util = new ExcelUtil<Assessmentresult>(Assessmentresult.class);
        util.exportExcel(response, list, "评价报告数据");
    }

    /**
     * 获取评价报告详细信息
     */
    @PreAuthorize("@ss.hasPermi('business:assessmentresult:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(assessmentresultService.selectAssessmentresultById(id));
    }

    /**
     * 新增评价报告
     */
    @PreAuthorize("@ss.hasPermi('business:assessmentresult:add')")
    @Log(title = "评价报告", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Assessmentresult assessmentresult)
    {
        return toAjax(assessmentresultService.insertAssessmentresult(assessmentresult));
    }

    /**
     * 修改评价报告
     */
    @PreAuthorize("@ss.hasPermi('business:assessmentresult:edit')")
    @Log(title = "评价报告", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Assessmentresult assessmentresult)
    {
        return toAjax(assessmentresultService.updateAssessmentresult(assessmentresult));
    }

    /**
     * 删除评价报告
     */
    @PreAuthorize("@ss.hasPermi('business:assessmentresult:remove')")
    @Log(title = "评价报告", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(assessmentresultService.deleteAssessmentresultByIds(ids));
    }
}
